<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
?>
<div class="navbar navbar-default">
	<div class="container">
		<span class="glyphicon glyphicon-search"></span>
	</div>
	<table>
		<td>
			<p class="navbar-brand">状态</p>
		</td>
		<td>
			<select id="status" name="status" class="form-control">
				<option value="All">所有</option>
				<option value="0">未读</option>
				<option value="1">已读</option>
				<option value="2">已发</option>
			</select>
		</td>
		
		<td>
			<p class="navbar-brand">关键字</p>
		</td>
		<td>
			<input name="key" type="text" class="form-control" class="search-query" placeholder="标题">
		</td>
		
		<td>
			<button class="btn btn-default" style="margin-left:15px" onclick="search()">搜索</button>
		</td>
	</table>
</div>

<div id="messageList" class="navbar navbar-default">
</div>

<script>
	function goPage(id)
	{
		for (i=0;i<(id-1)*10;i++)
			$('#listT'+i+'T').hide();
		for(i=(id-1)*10;i<(id)*10;i++)
			$('#listT'+i+'T').show();
		for (i=(id)*10;i<messageCount;i++)
			$('#listT'+i+'T').hide();
	}
	
	function refreshList()
	{
		$('#messageList').load('<?php echo Yii::app()->request->baseUrl;?>/notification/getMyMessageList');
	}
	
	function search()
	{
		var status=$('#status').val();
		$('#messageList').load('<?php echo Yii::app()->request->baseUrl;?>/notification/searchMessageList?status='+status);
	}
	
	function getList(s)
	{
		$('#messageList').load('<?php echo Yii::app()->request->baseUrl;?>/notification/searchMessageList?status='+s);
	}
	
	function getMessageDetail(id,listid)
	{
		$('.modal-content').load('<?php echo Yii::app()->request->baseUrl;?>/notification/viewMessageDetail?mid='+id);
		$('#list'+listid).children('td:last').text('');
		setTimeout(loadMessage(0),1000);
	}
	
	<?php 
		if (!isset($_GET['status']))
		{
			echo 'refreshList()';
		}else{
			echo 'getList('.$_GET['status'].')';
		}
	?>
</script>

<div class="modal fade in" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
	<div class="modal-dialog">
		<div class="modal-content"></div>
	</div><!-- /.modal-dialog -->
</div>